
const Remark = require('../model/remark.model')

class remarkService {
  async getRemark(params){
    const json = await Remark.findAll( 
      { where:{ rId:params.id,pId:null },
      include : {
        model: Remark,
        as:'children', 
        required : false,
        include : {
          all : true,
          nested : true,
          include : {
            all : true,
            nested : true,
            include : {
              all : true,
              nested : true,
              include : {
                all : true,
                nested : true,
                include : {
                  all : true,
                  nested : true,
                  include : {
                    all : true,
                    nested : true,
                    include : {
                      all : true,
                      nested : true,
                    }
                  }
                }
              }
            }
          }
        }
      }
    })
    return json;
  }
}


module.exports = new remarkService()